C = mpicc
CFLAGS =  -c -O2 -g 
INCLUDE = -I./include
LIBPATH = -L./lib
OBJECTS = Mem_Alloc Init Itera Basic_Opera Mem_Free Datatype Result
all: main

./lib/lib%.so: ./src/%.c
	$(C)  $(CFLAGS)  -o $@ $< $(INCLUDE) 

main: $(addsuffix .so, $(addprefix ./lib/lib, $(OBJECTS))) main.c 
	$(C) -g $(INCLUDE) main.c -o $@ $(LIBPATH) $(addprefix -l, $(OBJECTS)) -lfftw3 -lm -lstdc++

doxy:
	doxygen Doxyfile

clean:
	-rm ./lib/*.so
	-rm main
	-rm ./result/*.dat
	-rm -r html
	-rm -r main.dSYM
	-rm -r latex
